package com.wsjzzcbq.qianyuan.common.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * RequestUtil
 *
 * @author wsjz
 * @date 2021/10/27
 */
public class RequestUtils {

    /**
     * 获取请求 header
     * @param name
     * @return
     */
    public static String getHeaderByName(String name) {
        ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        return sra.getRequest().getHeader(name);
    }
}
